package exception;

public class FinallyDemo2 {
    public static void main(String[] args) {


    String line = null;
        System.out.println("系统开始");
        try {
        System.out.println(line.length());
    }
        catch (NullPointerException e) {
        System.out.println("出现问题");
    }
        catch (IndexOutOfBoundsException e) {
        System.out.println("出现异常");
    }
        finally {
        System.out.println("这是finally块");
    }

        System.out.println("系统结束");

    }
    public static int test() {
        try {
            return 1;
        }
        catch (Exception e) {
            return 3;
        }
        finally {
            return 2;
        }
    }
}

